import request from "@/utils/request";

// info    GET   /admin/acl/index/info
// login   POST  /admin/acl/index/login
// logout  POST  /admin/acl/index/logout

export interface userinfoModel {
    avatar: string,
    name: string,
    buttons: string[],
    roles: string[],
    routes: string[]
}

interface tokenModel {
    token: string
}
interface loginModel {
    username: string,
    password: string
}

export default {
    // 登录
    login(data: loginModel) {
        return request.post<any, tokenModel>(`/admin/acl/index/login`, data)
    },
    // 获取用户信息
    info() {
        return request.get<any, userinfoModel>(`/admin/acl/index/info`)
    },
    // 退出登录
    logout() {
        return request.post<any, null>(`/admin/acl/index/logout`)
    }
}